package com.victory.calculator.activity;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.aries.ui.view.title.TitleBarView;
import com.victory.calculator.CalculatorPath;
import com.victory.calculator.R;
import com.victory.calculator.adapter.ComputingAdapter;
import com.victory.calculator.entity.ComputingEntity;

import java.util.ArrayList;
import java.util.List;

import tech.com.commoncore.base.BaseTitleActivity;

@Route(path = CalculatorPath.CALCULATO_COMPUTING)
public class ComputingActivity extends BaseTitleActivity {

  RecyclerView recyclerView;
  ComputingAdapter mAdapter;

    @Override
    public void setTitleBar(TitleBarView titleBar) {
        titleBar.setTitleMainText(getResources().getString(R.string.calculator_activity_title));
    }

    @Override
    public int getContentLayout() {
        return R.layout.calculator_activity_computing;
    }

    @Override
    public void initView(Bundle savedInstanceState) {
        recyclerView = findViewById(R.id.rv_computing);
        recyclerView.setLayoutManager(new LinearLayoutManager(mContext));
        mAdapter = new ComputingAdapter(R.layout.calculator_itme_computing);
        recyclerView.setAdapter(mAdapter);

        getDatas();

    }


    private void getDatas() {
        List<ComputingEntity> list = new ArrayList<>();
        list.add(new ComputingEntity(getResources().getString(R.string.calculator_one_title),
                getResources().getString(R.string.calculator_one_msg),R.mipmap.tool_icon_shengou));
        list.add(new ComputingEntity(getResources().getString(R.string.calculator_two_title),
                getResources().getString(R.string.calculator_two_msg),R.mipmap.tool_icon_rengou));
        list.add(new ComputingEntity(getResources().getString(R.string.calculator_three_title),
                getResources().getString(R.string.calculator_three_msg),R.mipmap.tool_icon_shuhui));
//        list.add(new ComputingEntity(getResources().getString(R.string.calculator_four_title),getResources().getString(R.string.calculator_four_msg),0));
        mAdapter.setNewData(list);
    }
}
